import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { BookInfoModule } from './book-info/book-info.module';
import { TypeOrmModule } from '@nestjs/typeorm';
import { DB_PASSWD } from './config/db';

@Module({
  imports: [
    BookInfoModule,
    TypeOrmModule.forRoot({
      type: 'mysql',
      username: 'booker',
      password: DB_PASSWD,
      host: 'data.masaikk.fun',
      port: 3306,
      database: 'books',
      synchronize: true,
      retryDelay: 500,
      retryAttempts: 10,
      autoLoadEntities: true,
    }),
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}
